package com.cyj.service.impl;

import com.cyj.mapper.UserMapper;
import com.cyj.pojo.User;
import com.cyj.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;


    @Override
    public void save(User user) {
        userMapper.save(user);
    }

    @Override
    public void update(User user) {
        userMapper.update(user);
    }

    @Override
    public void delete(String id) {
userMapper.delete(id);
    }

    @Override
    public List<User> findAll() {
       return userMapper.findAll();
    }

    @Override
    public User findById(String id) {
        return userMapper.findById(id);
    }

    @Override
    public List<User> findByPage(Integer start, Integer rows) {
        start=(start-1)*rows;
        return userMapper.findByPage(start,rows);
    }

    @Override
    public Long findTotals() {
        return userMapper.findTotals();
    }
}